﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PhoneDBModel;

public partial class Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        PhoneDBEntities dbe = new PhoneDBEntities();
        User usr = new User();
        usr.UserName = txtUser.Text;
        usr.Password = txtPassword.Text;
        usr.Email = txtEmail.Text;
        usr.Phone = txtPhone.Text;
        dbe.Users.AddObject(usr);
        dbe.SaveChanges();

        AccountBalance ab = new AccountBalance();
        ab.Userid = usr.Id;
        dbe.AccountBalances.AddObject(ab);
        dbe.SaveChanges();

        Response.Redirect("Login.aspx");
    }
}